const config = require("./config")
const opn = require('opn')
module.exports = {
    hooks: {
        listen(server, { host, port }) {
            opn(`http://${host}:${port}`)
        }
    },
    head: {
        meta: [
            { charset: 'utf-8' },
            { name: 'viewport', content: 'width=device-width, initial-scale=1' },
            { name: 'renderer', content: 'webkit' },
            { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge' }
        ],
        link: [
            { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
            { rel: 'stylesheet', href: '//at.alicdn.com/t/font_553862_l46uef0ik34k7qfr.css' },
            { rel: 'stylesheet', href: '//cdn.bootcss.com/animate.css/3.5.2/animate.css' },
            { rel: 'stylesheet', href: '//unpkg.com/iview@2.9.2/dist/styles/iview.css' }
        ]
    },
    css: [
        '~assets/styles/common.css',
        {
            src: '~assets/styles/customer.less',
            lang: 'less'
        },
        '~assets/styles/fullpage.css'
    ],
    loading: { color: '#0088f5' },
    router: {
        //mode: 'hash'
    },
    performance: {
        prefetch: false
    },
    render: {
        resourceHints: false
    },
    modules: [
        '@nuxtjs/proxy'
    ],
    proxy: config.proxy,
    build: {
        analyze: false,
        babel: {
            presets: [
                ['vue-app', {
                    useBuiltIns: true,
                    targets: { ie: 9, uglify: true }
                }]
            ]
        },
        extend(config, { isDev, isClient }) {
            if (isClient) {
                config.devtool = 'source-map'
            }
        },
        vendor: ['babel-polyfill', 'axios']
    },
    plugins: [
        { src: '~plugins/iview.js', ssr: true },
        { src: '~/plugins/filters.js' },
        { src: '~/plugins/progress.js' },
        { src: '~/plugins/tongji.js', ssr: false },
        { src: '~/plugins/velocity.js', ssr: false },
        { src: '~/plugins/fullpage.js', ssr: false }
    ],
    env: {
        PATH_TYPE: process.env.PATH_TYPE
    }
}
